package com.drink.yan.web.rest;

import com.alibaba.fastjson.JSONObject;
import com.drink.yan.domain.YanUserDo;
import com.drink.yan.intf.define.YanOpSourceStatusE;
import com.drink.yan.intf.entity.*;
import com.drink.yan.intf.vo.*;
import com.drink.yan.svc.service.YanActivityService;
import com.drink.yan.svc.service.YanOrderService;
import com.drink.yan.svc.service.YanTaskService;
import com.drink.yan.svc.service.YanUserService;
import com.drink.yan.web.rest.req.cmd.*;
import com.drink.yan.web.rest.req.qry.*;
import com.meta.framework.act.entity.SysUser;
import com.meta.framework.common.annotation.Log;
import com.meta.framework.common.core.controller.BaseController;
import com.meta.framework.common.core.page.TableResponseVo;
import com.meta.framework.common.enums.BusinessType;
import com.meta.framework.common.utils.SecurityUtils;
import com.meta.framework.common.utils.poi.ExcelUtil;
import com.meta.framework.core.CommonRes;
import com.meta.framework.core.ResponseVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * java类简单作用描述
 *
 * @Title:
 * @Package: com.drink.yan.web.rest.app.
 * @Author: M.simple
 * @Remark: The modified content
 * @CreateDate: 2023/11/23 14:58
 * @Version: v2.0
 */
@RestController
@RequestMapping("/user")
public class UserRest extends BaseController {


    @Resource
    private YanUserService yanUserService;

    @ApiOperation(value = "申请成为老师", notes = "申请成为老师", tags = {"PC"})
    @PostMapping("/applyTeacher")
    public ResponseVo<YanUserDo> applyTeacherInfo(@RequestBody ApplyTeacherInfoCmd cmd){

        YanUserDo customerVo = yanUserService.applyTeacherInfo(cmd);

        return ResponseVo.success(customerVo);
    }

    @ApiOperation(value = "数据授权", notes = "数据授权", tags = {"PC"})
    @PostMapping("/data/auth")
    public ResponseVo<YanUserDo> dataAuth(@RequestBody UserDataAuthCmd cmd){

       yanUserService.dataAuth(cmd);

        return ResponseVo.success();
    }

    @ApiOperation(value = "老师列表", notes = "老师列表", tags = {"PC"})
    @GetMapping("/teacher/page")
    public TableResponseVo<List<UserTeacherVo>> pageTeacher(PageTeacherQry qry){

        startPage();
        List<UserTeacherVo> list = yanUserService.listTeacher(qry);

        return getResponseVoTable(list);
    }

    @ApiOperation(value = "代理列表", notes = "代理列表", tags = {"员工小程序"})
    @GetMapping("/agency/list")
    public ResponseVo<List<UserAgencyVo>> pageAnency(){

        List<UserAgencyVo> list = yanUserService.listAgency(null);

        return ResponseVo.success(list);
    }


}
